Skip to content

Conversation

@dirixmjm
Copy link
Contributor

@dirixmjm dirixmjm commented Sep 11, 2025

Summary by CodeRabbit

  • New Features
    • Added a configurable "Measurement report interval" number setting for compatible Plugwise USB devices (minutes, 1–60). Labels available in English and Dutch.
  • Chores
    • Re-enabled a previously ignored lint rule in tooling.
    • Bumped integration and dependency versions (plugwise-usb to v0.46.0, integration v0.57.0) and updated changelog.

@coderabbitai
Copy link

coderabbitai bot commented Sep 11, 2025

Walkthrough

Adds a new numeric entity description for a measurement report interval (report_interval) to NUMBER_TYPES, updates UI strings and translations, bumps package/manifest versions, and removes a Ruff ignore for UP038 in pyproject.toml.

Changes

Cohort / File(s) Summary of Changes
Number entity: report interval
custom_components/plugwise_usb/number.py
Added report_interval PlugwiseNumberEntityDescription (key="report_interval", translation_key="sense_report_interval", async_number_fn="set_report_interval", node_feature=NodeFeature.SENSE_HYSTERESIS, device_class=NumberDeviceClass.DURATION, unit=UnitOfTime.MINUTES, entity_category=EntityCategory.CONFIG, native_min=1, native_max=60, native_step=1, mode="box").
Localization and labels
custom_components/plugwise_usb/strings.json, custom_components/plugwise_usb/translations/en.json, custom_components/plugwise_usb/translations/nl.json
Added sense_report_interval label: strings.json -> "Measurement report interval"; translations/en.json -> "Measurement reporting interval"; translations/nl.json -> "Meetrapportage-interval".
Manifest and versioning
custom_components/plugwise_usb/manifest.json, pyproject.toml, CHANGELOG.md
Bumped integration version (0.56.0 → 0.57.0) and plugwise-usb requirement (0.45.0 → 0.46.0); pyproject project version bumped (0.55.13 → 0.57.0); added CHANGELOG entry for v0.57.0.
Tooling/config
pyproject.toml
Removed Ruff ignore for UP038 (re-enabling that lint rule); no runtime code changes.

Sequence Diagram(s)

sequenceDiagram
  participant U as User (HA UI)
  participant HA as Home Assistant Number Entity
  participant PW as Plugwise USB Integration
  participant N as USB Node

  U->>HA: Set report_interval (minutes)
  HA->>PW: call async_number_fn: set_report_interval(value)
  PW->>N: send new reporting interval
  N-->>PW: acknowledge / apply
  PW-->>HA: update entity state
  HA-->>U: show updated value
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • bouwew

Poem

A rabbit taps the interval drum,
Tick, hop, tick—reports will come.
Minutes boxed from one to sixty,
Sensors hum in steady ditty.
I twitch my nose — the setting's set. 🥕⏱️


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d29c4bf and 478184a.

📒 Files selected for processing (7)
  • CHANGELOG.md (1 hunks)
  • custom_components/plugwise_usb/manifest.json (1 hunks)
  • custom_components/plugwise_usb/number.py (1 hunks)
  • custom_components/plugwise_usb/strings.json (1 hunks)
  • custom_components/plugwise_usb/translations/en.json (1 hunks)
  • custom_components/plugwise_usb/translations/nl.json (1 hunks)
  • pyproject.toml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (5)
  • custom_components/plugwise_usb/number.py
  • pyproject.toml
  • custom_components/plugwise_usb/translations/nl.json
  • custom_components/plugwise_usb/translations/en.json
  • custom_components/plugwise_usb/strings.json
🔇 Additional comments (2)
custom_components/plugwise_usb/manifest.json (2)

13-13: Approve version bump to 0.57.0 — metadata and changelog are in sync.
Manifest, pyproject.toml, and CHANGELOG.md all show 0.57.0 (CHANGELOG entry dated 2025-09-12 referencing PR #331).


12-12: Sanity-check plugwise-usb 0.46.0 API and gating
Pin to 0.46.0 looks correct—sense_report_interval entity and translations are present, and the number entity is tied to NodeFeature.SENSE_HYSTERESIS. Manually confirm that plugwise-usb 0.46.0 defines set_report_interval and NodeFeature.SENSE_HYSTERESIS, and that your async_setup_entry filters descriptions by node.features to guard unsupported devices.

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Expose Sense report interval to HA" is concise and directly reflects the primary change: exposing the Sense report_interval configuration to Home Assistant via a new Number entity and related translations/manifest updates, so a reviewer scanning history will understand the main intent. It is specific, focused, and free of irrelevant noise.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch mdi_sense

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dirixmjm
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Sep 11, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
custom_components/plugwise_usb/translations/en.json (1)

176-178: Improve wording for natural English

"Measurement report interval" reads awkwardly; "Measurement reporting interval" is idiomatic and aligns with similar labels.

-      "sense_report_interval": {
-        "name": "Measurement report interval"
+      "sense_report_interval": {
+        "name": "Measurement reporting interval"
custom_components/plugwise_usb/strings.json (1)

176-178: Keep base string consistent with en translation

Mirror the improved phrasing so translations stay in sync.

-      "sense_report_interval": {
-        "name": "Measurement report interval"
+      "sense_report_interval": {
+        "name": "Measurement reporting interval"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a09f24 and d29c4bf.

📒 Files selected for processing (5)
  • custom_components/plugwise_usb/number.py (1 hunks)
  • custom_components/plugwise_usb/strings.json (1 hunks)
  • custom_components/plugwise_usb/translations/en.json (1 hunks)
  • custom_components/plugwise_usb/translations/nl.json (1 hunks)
  • pyproject.toml (0 hunks)
💤 Files with no reviewable changes (1)
  • pyproject.toml

@sonarqubecloud
Copy link

@dirixmjm dirixmjm marked this pull request as ready for review September 12, 2025 08:47
@dirixmjm dirixmjm requested a review from a team as a code owner September 12, 2025 08:47
@dirixmjm dirixmjm requested review from bouwew and removed request for a team September 12, 2025 08:59
Copy link
Contributor

@bouwew bouwew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @dirixmjm !

@dirixmjm dirixmjm merged commit 3206367 into main Sep 12, 2025
12 checks passed
@bouwew bouwew deleted the mdi_sense branch September 16, 2025 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants